package com.wanlian.netty.model;

import com.wanlian.util.DateUtil;
import io.netty.channel.ChannelId;

import java.sql.Timestamp;

public class ChannelInfo {

    private ChannelId channelId;

    private Timestamp lastConnectTime;

    private Timestamp firstTime;

    public ChannelInfo() {
        this.firstTime = DateUtil.currentTimestamp();
        this.setLastConnectTime(DateUtil.currentTimestamp());
    }

    public ChannelInfo(ChannelId channelId) {
        this.setChannelId(channelId);
        this.firstTime = DateUtil.currentTimestamp();
        this.setLastConnectTime(DateUtil.currentTimestamp());
    }


    public ChannelId getChannelId() {
        return channelId;
    }

    public void setChannelId(ChannelId channelId) {
        this.channelId = channelId;
    }

    public Timestamp getLastConnectTime() {
        return lastConnectTime;
    }

    public void setLastConnectTime(Timestamp lastConnectTime) {
        this.lastConnectTime = lastConnectTime;
    }

    public void refrushTime() {
        this.setLastConnectTime(DateUtil.currentTimestamp());
    }

    public Timestamp getFirstTime() {
        return firstTime;
    }

    public void setFirstTime(Timestamp firstTime) {
        this.firstTime = firstTime;
    }
}
